package com.speechb.test;

import org.junit.Test;
import org.owasp.esapi.ESAPI;
import org.owasp.esapi.codecs.MySQLCodec;

/**
 * @author : llj
 * @version :2.1.0
 * @date : 2020/4/15 8:15
 */
public class security_test {
    @Test
    public void test1() {
        String username = "te%st";
        MySQLCodec codec = new MySQLCodec(MySQLCodec.Mode.STANDARD);
        String s = ESAPI.encoder().encodeForSQL(codec, username);
        System.out.println(s);
    }

    @Test
    public void test2() {
        String str1 ="[0-9a-zA-Z_]+";
        if ("admin_".matches(str1)) {
            System.out.println("正确");
        } else {
            System.out.println("错误");
        }
    }
}
